Conversation
Reduce onboarding from 4 steps to 3 by removing the engine configuration step (PaddleOCR/MTranServer setup moved to Settings). Add permission purpose descriptions, skip-for-now option with timeout hint, and menubar location guidance on completion page.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthrough精简引导流程为 3 步:移除配置/PaddleOCR 步骤,新增权限跳过逻辑与超时检测;在完成页显示菜单栏提示与权限未授予警告;更新相关视图、视图模型、本地化与持久化设置,窗口高度由 620 调整为 520。 Changes
Sequence Diagram(s)sequenceDiagram
participant User as "用户"
participant View as "OnboardingView / Step Views"
participant VM as "OnboardingViewModel"
participant Sys as "系统权限 检查/API"
participant Settings as "AppSettings (持久化)"
User->>View: 触发请求权限或点击“跳过权限”
View->>VM: 请求检查/轮询权限或调用 onSkip()
VM->>Sys: 请求/轮询权限状态
Sys-->>VM: 返回权限已授予/未授予
alt 超时(30s)
VM->>View: 设置 permissionCheckTimedOut = true
end
alt 用户选择跳过
VM->>Settings: 设置 userSkippedPermissions = true
VM->>View: 标记 hasSkippedPermissions 并 完成引导
else 权限授予
VM->>View: 允许继续下一步
end
估计代码审查工作量🎯 4 (Complex) | ⏱️ ~45 minutes 可能相关的拉取请求
概述此拉取请求简化了引导流程,从4步减少至3步。移除了可选配置步骤,添加了权限跳过功能,并在完成步骤中显示权限警告。更新了UI组件以支持权限超时提示和跳过按钮,同时调整了本地化文案和应用窗口大小。 变更
诗歌
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
ScreenTranslate/Resources/en.lproj/Localizable.strings (1)
545-547: 可选:优化权限副标题语义一致性与可读性。当前文案可用,但
capture & translate和OCR text recognition的表达稍显口语/重复,建议统一为更自然的产品文案。建议文案(可选)
-"onboarding.permission.screen.recording.subtitle" = "For capturing screen content for OCR text recognition"; +"onboarding.permission.screen.recording.subtitle" = "Required to capture screen content for OCR."; -"onboarding.permission.accessibility.subtitle" = "For registering global shortcuts to trigger capture & translate from any app"; +"onboarding.permission.accessibility.subtitle" = "Required to register global shortcuts for capture and translation in any app.";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ScreenTranslate/Resources/en.lproj/Localizable.strings` around lines 545 - 547, The permission subtitle strings are inconsistent and slightly informal; update the values for "onboarding.permission.screen.recording.subtitle", "onboarding.permission.accessibility", and "onboarding.permission.accessibility.subtitle" to use consistent, user-facing product language (e.g., replace "For capturing screen content for OCR text recognition" with "Capture screen content for text recognition", change "Accessibility" only if needed to a matched label like "Accessibility permission", and replace "For registering global shortcuts to trigger capture & translate from any app" with "Enable global shortcuts to capture and translate from any app") so the tone and phrasing are concise and uniform across keys.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@ScreenTranslate/Resources/en.lproj/Localizable.strings`:
- Around line 545-547: The permission subtitle strings are inconsistent and
slightly informal; update the values for
"onboarding.permission.screen.recording.subtitle",
"onboarding.permission.accessibility", and
"onboarding.permission.accessibility.subtitle" to use consistent, user-facing
product language (e.g., replace "For capturing screen content for OCR text
recognition" with "Capture screen content for text recognition", change
"Accessibility" only if needed to a matched label like "Accessibility
permission", and replace "For registering global shortcuts to trigger capture &
translate from any app" with "Enable global shortcuts to capture and translate
from any app") so the tone and phrasing are concise and uniform across keys.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f8e6c20c-226c-4a5b-b4d0-78e536426c4b
📒 Files selected for processing (10)
ScreenTranslate/Features/Onboarding/OnboardingCompleteStepView.swiftScreenTranslate/Features/Onboarding/OnboardingComponents.swiftScreenTranslate/Features/Onboarding/OnboardingConfigurationStepView.swiftScreenTranslate/Features/Onboarding/OnboardingPermissionsStepView.swiftScreenTranslate/Features/Onboarding/OnboardingView.swiftScreenTranslate/Features/Onboarding/OnboardingViewModel.swiftScreenTranslate/Features/Onboarding/OnboardingWindowController.swiftScreenTranslate/Models/AppSettings.swiftScreenTranslate/Resources/en.lproj/Localizable.stringsScreenTranslate/Resources/zh-Hans.lproj/Localizable.strings
💤 Files with no reviewable changes (1)
- ScreenTranslate/Features/Onboarding/OnboardingConfigurationStepView.swift
Move lastCounter and timer references to class properties to avoid sending non-Sendable values across isolation boundaries.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@ScreenTranslate/Features/Preview/PreviewWindow.swift`:
- Around line 15-19: The imageSizeTimer is never invalidated, causing a resource
leak; update PreviewWindow to invalidate and nil out imageSizeTimer when the
preview is closed or the object is deallocated by adding cleanup in
closePreview() (call imageSizeTimer?.invalidate(); imageSizeTimer = nil) and/or
implement deinit to perform the same invalidation so the timer stops running
when the window is closed or PreviewWindow is released.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a0469503-18e7-46c4-a32f-27355acade12
📒 Files selected for processing (1)
ScreenTranslate/Features/Preview/PreviewWindow.swift
| /// Timer for observing image size changes | ||
| private var imageSizeTimer: Timer? | ||
|
|
||
| /// Tracks the last image size change counter value | ||
| private var lastImageSizeCounter: Int = 0 |
There was a problem hiding this comment.
Timer 未被清理导致资源泄漏。
imageSizeTimer 被创建后从未被 invalidate。当窗口关闭或释放时,定时器仍会继续运行(虽然因为 [weak self] 不会崩溃,但会持续消耗资源)。
建议添加 deinit 或在 closePreview() 中清理定时器:
🛠️ 建议修复方案
/// Tracks the last image size change counter value
private var lastImageSizeCounter: Int = 0
+ deinit {
+ imageSizeTimer?.invalidate()
+ imageSizeTimer = nil
+ }
+
// MARK: - Initialization或者在 closePreview() 中添加清理逻辑:
`@MainActor`
func closePreview() {
+ imageSizeTimer?.invalidate()
+ imageSizeTimer = nil
// Delay state modification to avoid "Modifying state during view update" warning
DispatchQueue.main.async { [weak self] in
self?.viewModel.hide()
}
close()
}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@ScreenTranslate/Features/Preview/PreviewWindow.swift` around lines 15 - 19,
The imageSizeTimer is never invalidated, causing a resource leak; update
PreviewWindow to invalidate and nil out imageSizeTimer when the preview is
closed or the object is deallocated by adding cleanup in closePreview() (call
imageSizeTimer?.invalidate(); imageSizeTimer = nil) and/or implement deinit to
perform the same invalidation so the timer stops running when the window is
closed or PreviewWindow is released.
- Fix button calling both requestAction and openSettingsAction (caused wrong permission dialog to appear) - Increase window height from 520 to 580 to fit all content - Defer Keychain access on launch to avoid prompt during onboarding - Add note about removing and re-adding app for permission changes
Summary
Changes
skipPermissions()andpermissionCheckTimedOutOnboardingPermissionRownow acceptssubtitleparameteruserSkippedPermissionspersisted flagOnboardingConfigurationStepView.swift(199 lines removed)Test plan
ScreenTranslate.onboardingCompletedin UserDefaults, relaunch appSummary by CodeRabbit
发布说明
新功能
改进